package org.pz.vo;

import lombok.Data;
import org.pz.enums.TaskTypeEnum;
import org.pz.validation.BeanScheduleAdd;
import org.pz.validation.BeanScheduleOperate;
import org.pz.validation.BeanScheduleUpdate;

import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * 增删改查调度任务用
 * */
@Data
public class TaskVo implements Serializable {

    @NotNull(groups = {BeanScheduleAdd.class, BeanScheduleUpdate.class, BeanScheduleOperate.class})
    private TaskTypeEnum type;

    //任务名称
    @NotNull(groups = {BeanScheduleAdd.class, BeanScheduleUpdate.class, BeanScheduleOperate.class})
    private String jobName;

    //cron 表达式
    @NotNull(groups = {BeanScheduleAdd.class, BeanScheduleUpdate.class})
    private String cron;

    //服务名
    @NotNull(groups = {BeanScheduleAdd.class, BeanScheduleUpdate.class, BeanScheduleOperate.class})
    private String applicationName;

    //当 type 为 bean 时，必填
    @NotNull(groups = BeanScheduleAdd.class)
    private String code;
}
